package com.ftg.learn.chapter09.listtest;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @author lijiaxin
 * @version 1.0
 * @date 2023/8/18 10:34
 */

public class WorkDemo {

    public static void main(String[] args) {
        List<Worker> list = new ArrayList<>();

        list.add(new Worker("张三",18,3000));
        list.add(new Worker("李四",25,3500));
        list.add(new Worker("王五",22,3200));
        list.add(1,new Worker("赵六",24,3300));

        list.remove(3);

        for (Worker worker:list) {
            System.out.println(worker);
        }

        Iterator<Worker> it=list.iterator();
        while (it.hasNext()){
           Worker workes= it.next();
           workes.work();

        }
        it.equals(list);


    }

}
